<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 1rem;
      height: 1rem;
      font-size: .5rem;
      background: rgb(214, 212, 191);
    }
  </style>
</head>

<body>
  <div class="box">
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Nam, consequatur?
  </div>
</body>
<!-- <script src="flexble.js"></script> -->
<script>
  // 基础原理
  function flexble() {
    let doc = document.documentElement;
    let w = doc.clientWidth / 10;
    doc.style.fontSize = w + 'px';
  }
  flexble();
  window.addEventListener('resize', flexble);
</script>

</html>